﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.Business.DAL
{
    /// <summary>
    /// 数据访问类t_Business_EmpSetting。
    /// </summary>
    public class t_Business_EmpSetting
    {
        public t_Business_EmpSetting()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public static bool Exists(Guid RecordId)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1) from t_Business_EmpSetting where RecordId=@RecordId ");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            int cmdresult;
            object obj = db.ExecuteScalar(dbCommand);
            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            if (cmdresult == 0)
            {
                return false;
            }
            else
            {
                return true;
            }
        }


        /// <summary>
        /// 增加一条数据
        /// </summary>
        public static void Add(Chenxin.Lib.Business.Entity.t_Business_EmpSetting model)
        {
            StringBuilder strSql = new StringBuilder("Chenxin_Business");
            strSql.Append("insert into t_Business_EmpSetting(");
            strSql.Append("RecordId,CityId,City,CompanyId,Company,DepartId,DepartName,UserId,UserCode,UserName,IsBelong,IsControl,SearchContractArchive,EditContractArchive,CancelContractArchive,SearchContractApply,EditContractApply,Addtime,SearchIntention,SearchBargain,SearchMoney,SearchBill,SearchPaidItems,SearchCommisionDetail,SearchIncomeSummary,SearchIncomeDetails,SearchIncomePersonal,SearchAchievementStat,SearchBargainStat,SearchAchievementDetail,SearchPersonalRank,SearchInCome,SearchTurnover,SearchIncomeOwner,SearchPreliminary,SearchLoan,SearchLitigation,SearchNotLitigation,SearchTransfer,SearchLinkage,SearchCharge)");

            strSql.Append(" values (");
            strSql.Append("@RecordId,@CityId,@City,@CompanyId,@Company,@DepartId,@DepartName,@UserId,@UserCode,@UserName,@IsBelong,@IsControl,@SearchContractArchive,@EditContractArchive,@CancelContractArchive,@SearchContractApply,@EditContractApply,@Addtime,@SearchIntention,@SearchBargain,@SearchMoney,@SearchBill,@SearchPaidItems,@SearchCommisionDetail,@SearchIncomeSummary,@SearchIncomeDetails,@SearchIncomePersonal,@SearchAchievementStat,@SearchBargainStat,@SearchAchievementDetail,@SearchPersonalRank,@SearchInCome,@SearchTurnover,@SearchIncomeOwner,@SearchPreliminary,@SearchLoan,@SearchLitigation,@SearchNotLitigation,@SearchTransfer,@SearchLinkage,@SearchCharge)");
            Database db = DatabaseFactory.CreateDatabase();
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "City", DbType.AnsiString, model.City);
            db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
            db.AddInParameter(dbCommand, "Company", DbType.AnsiString, model.Company);
            db.AddInParameter(dbCommand, "DepartId", DbType.Guid, model.DepartId);
            db.AddInParameter(dbCommand, "DepartName", DbType.AnsiString, model.DepartName);
            db.AddInParameter(dbCommand, "UserId", DbType.Guid, model.UserId);
            db.AddInParameter(dbCommand, "UserCode", DbType.AnsiString, model.UserCode);
            db.AddInParameter(dbCommand, "UserName", DbType.AnsiString, model.UserName);
            db.AddInParameter(dbCommand, "IsBelong", DbType.Boolean, model.IsBelong);
            db.AddInParameter(dbCommand, "IsControl", DbType.Boolean, model.IsControl);
            db.AddInParameter(dbCommand, "SearchContractArchive", DbType.Boolean, model.SearchContractArchive);
            db.AddInParameter(dbCommand, "EditContractArchive", DbType.Boolean, model.EditContractArchive);
            db.AddInParameter(dbCommand, "CancelContractArchive", DbType.Boolean, model.CancelContractArchive);
            db.AddInParameter(dbCommand, "SearchContractApply", DbType.Boolean, model.SearchContractApply);
            db.AddInParameter(dbCommand, "EditContractApply", DbType.Boolean, model.EditContractApply);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            db.AddInParameter(dbCommand, "SearchIntention", DbType.Boolean, model.SearchIntention);
            db.AddInParameter(dbCommand, "SearchBargain", DbType.Boolean, model.SearchBargain);
            db.AddInParameter(dbCommand, "SearchMoney", DbType.Boolean, model.SearchMoney);
            db.AddInParameter(dbCommand, "SearchBill", DbType.Boolean, model.SearchBill);
            db.AddInParameter(dbCommand, "SearchPaidItems", DbType.Boolean, model.SearchPaidItems);
            db.AddInParameter(dbCommand, "SearchCommisionDetail", DbType.Boolean, model.SearchCommisionDetail);
            db.AddInParameter(dbCommand, "SearchIncomeSummary", DbType.Boolean, model.SearchIncomeSummary);
            db.AddInParameter(dbCommand, "SearchIncomeDetails", DbType.Boolean, model.SearchIncomeDetails);
            db.AddInParameter(dbCommand, "SearchIncomePersonal", DbType.Boolean, model.SearchIncomePersonal);
            db.AddInParameter(dbCommand, "SearchAchievementStat", DbType.Boolean, model.SearchAchievementStat);
            db.AddInParameter(dbCommand, "SearchBargainStat", DbType.Boolean, model.SearchBargainStat);
            db.AddInParameter(dbCommand, "SearchAchievementDetail", DbType.Boolean, model.SearchAchievementDetail);
            db.AddInParameter(dbCommand, "SearchPersonalRank", DbType.Boolean, model.SearchPersonalRank);
            db.AddInParameter(dbCommand, "SearchInCome", DbType.Boolean, model.SearchInCome);
            db.AddInParameter(dbCommand, "SearchTurnover", DbType.Boolean, model.SearchTurnover);
            db.AddInParameter(dbCommand, "SearchIncomeOwner", DbType.Boolean, model.SearchIncomeOwner);
            db.AddInParameter(dbCommand, "SearchPreliminary", DbType.Boolean, model.SearchPreliminary);
            db.AddInParameter(dbCommand, "SearchLoan", DbType.Boolean, model.SearchLoan);
            db.AddInParameter(dbCommand, "SearchLitigation", DbType.Boolean, model.SearchLitigation);
            db.AddInParameter(dbCommand, "SearchNotLitigation", DbType.Boolean, model.SearchNotLitigation);
            db.AddInParameter(dbCommand, "SearchTransfer", DbType.Boolean, model.SearchTransfer);
            db.AddInParameter(dbCommand, "SearchLinkage", DbType.Boolean, model.SearchLinkage);
            db.AddInParameter(dbCommand, "SearchCharge", DbType.Boolean, model.SearchCharge);            
            db.ExecuteNonQuery(dbCommand);
        }
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public static void Update(Chenxin.Lib.Business.Entity.t_Business_EmpSetting model)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("update t_Business_EmpSetting set ");
            strSql.Append("CityId=@CityId,");
            strSql.Append("City=@City,");
            strSql.Append("CompanyId=@CompanyId,");
            strSql.Append("Company=@Company,");
            strSql.Append("DepartId=@DepartId,");
            strSql.Append("DepartName=@DepartName,");
            strSql.Append("UserId=@UserId,");
            strSql.Append("UserCode=@UserCode,");
            strSql.Append("UserName=@UserName,");
            strSql.Append("IsBelong=@IsBelong,");
            strSql.Append("IsControl=@IsControl,");
            strSql.Append("SearchContractArchive=@SearchContractArchive,");
            strSql.Append("EditContractArchive=@EditContractArchive,");
            strSql.Append("CancelContractArchive=@CancelContractArchive,");
            strSql.Append("SearchContractApply=@SearchContractApply,");
            strSql.Append("EditContractApply=@EditContractApply,");
            strSql.Append("Addtime=@Addtime,");
            strSql.Append("SearchIntention=@SearchIntention,");
            strSql.Append("SearchBargain=@SearchBargain,");
            strSql.Append("SearchMoney=@SearchMoney,");
            strSql.Append("SearchBill=@SearchBill,");
            strSql.Append("SearchPaidItems=@SearchPaidItems,");
            strSql.Append("SearchCommisionDetail=@SearchCommisionDetail,");
            strSql.Append("SearchIncomeSummary=@SearchIncomeSummary,");
            strSql.Append("SearchIncomeDetails=@SearchIncomeDetails,");
            strSql.Append("SearchIncomePersonal=@SearchIncomePersonal,");
            strSql.Append("SearchAchievementStat=@SearchAchievementStat,");
            strSql.Append("SearchBargainStat=@SearchBargainStat,");
            strSql.Append("SearchAchievementDetail=@SearchAchievementDetail,");
            strSql.Append("SearchPersonalRank=@SearchPersonalRank,");
            strSql.Append("SearchInCome=@SearchInCome,");
            strSql.Append("SearchTurnover=@SearchTurnover,");
            strSql.Append("SearchIncomeOwner=@SearchIncomeOwner,");
            strSql.Append("SearchPreliminary=@SearchPreliminary,");
            strSql.Append("SearchLoan=@SearchLoan,");
            strSql.Append("SearchLitigation=@SearchLitigation,");
            strSql.Append("SearchNotLitigation=@SearchNotLitigation,");
            strSql.Append("SearchTransfer=@SearchTransfer,");
            strSql.Append("SearchLinkage=@SearchLinkage,");
            strSql.Append("SearchCharge=@SearchCharge");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, model.RecordId);
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "City", DbType.AnsiString, model.City);
            db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
            db.AddInParameter(dbCommand, "Company", DbType.AnsiString, model.Company);
            db.AddInParameter(dbCommand, "DepartId", DbType.Guid, model.DepartId);
            db.AddInParameter(dbCommand, "DepartName", DbType.AnsiString, model.DepartName);
            db.AddInParameter(dbCommand, "UserId", DbType.Guid, model.UserId);
            db.AddInParameter(dbCommand, "UserCode", DbType.AnsiString, model.UserCode);
            db.AddInParameter(dbCommand, "UserName", DbType.AnsiString, model.UserName);
            db.AddInParameter(dbCommand, "IsBelong", DbType.Boolean, model.IsBelong);
            db.AddInParameter(dbCommand, "IsControl", DbType.Boolean, model.IsControl);
            db.AddInParameter(dbCommand, "SearchContractArchive", DbType.Boolean, model.SearchContractArchive);
            db.AddInParameter(dbCommand, "EditContractArchive", DbType.Boolean, model.EditContractArchive);
            db.AddInParameter(dbCommand, "CancelContractArchive", DbType.Boolean, model.CancelContractArchive);
            db.AddInParameter(dbCommand, "SearchContractApply", DbType.Boolean, model.SearchContractApply);
            db.AddInParameter(dbCommand, "EditContractApply", DbType.Boolean, model.EditContractApply);
            db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
            db.AddInParameter(dbCommand, "SearchIntention", DbType.Boolean, model.SearchIntention);
            db.AddInParameter(dbCommand, "SearchBargain", DbType.Boolean, model.SearchBargain);
            db.AddInParameter(dbCommand, "SearchMoney", DbType.Boolean, model.SearchMoney);
            db.AddInParameter(dbCommand, "SearchBill", DbType.Boolean, model.SearchBill);
            db.AddInParameter(dbCommand, "SearchPaidItems", DbType.Boolean, model.SearchPaidItems);
            db.AddInParameter(dbCommand, "SearchCommisionDetail", DbType.Boolean, model.SearchCommisionDetail);
            db.AddInParameter(dbCommand, "SearchIncomeSummary", DbType.Boolean, model.SearchIncomeSummary);
            db.AddInParameter(dbCommand, "SearchIncomeDetails", DbType.Boolean, model.SearchIncomeDetails);
            db.AddInParameter(dbCommand, "SearchIncomePersonal", DbType.Boolean, model.SearchIncomePersonal);
            db.AddInParameter(dbCommand, "SearchAchievementStat", DbType.Boolean, model.SearchAchievementStat);
            db.AddInParameter(dbCommand, "SearchBargainStat", DbType.Boolean, model.SearchBargainStat);
            db.AddInParameter(dbCommand, "SearchAchievementDetail", DbType.Boolean, model.SearchAchievementDetail);
            db.AddInParameter(dbCommand, "SearchPersonalRank", DbType.Boolean, model.SearchPersonalRank);
            db.AddInParameter(dbCommand, "SearchInCome", DbType.Boolean, model.SearchInCome);
            db.AddInParameter(dbCommand, "SearchTurnover", DbType.Boolean, model.SearchTurnover);
            db.AddInParameter(dbCommand, "SearchIncomeOwner", DbType.Boolean, model.SearchIncomeOwner);
            db.AddInParameter(dbCommand, "SearchPreliminary", DbType.Boolean, model.SearchPreliminary);
            db.AddInParameter(dbCommand, "SearchLoan", DbType.Boolean, model.SearchLoan);
            db.AddInParameter(dbCommand, "SearchLitigation", DbType.Boolean, model.SearchLitigation);
            db.AddInParameter(dbCommand, "SearchNotLitigation", DbType.Boolean, model.SearchNotLitigation);
            db.AddInParameter(dbCommand, "SearchTransfer", DbType.Boolean, model.SearchTransfer);
            db.AddInParameter(dbCommand, "SearchLinkage", DbType.Boolean, model.SearchLinkage);
            db.AddInParameter(dbCommand, "SearchCharge", DbType.Boolean, model.SearchCharge);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 删除一条数据
        /// </summary>
        public static void Delete(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("delete from t_Business_EmpSetting ");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            db.ExecuteNonQuery(dbCommand);

        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Business_EmpSetting GetModel(Guid RecordId)
        {

            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,CityId,City,CompanyId,Company,DepartId,DepartName,UserId,UserCode,UserName,IsBelong,IsControl,SearchContractArchive,EditContractArchive,CancelContractArchive,SearchContractApply,EditContractApply,Addtime,SearchIntention,SearchBargain,SearchMoney,SearchBill,SearchPaidItems,SearchCommisionDetail,SearchIncomeSummary,SearchIncomeDetails,SearchIncomePersonal,SearchAchievementStat,SearchBargainStat,SearchAchievementDetail,SearchPersonalRank,SearchInCome,SearchTurnover,SearchIncomeOwner,SearchPreliminary,SearchLoan,SearchLitigation,SearchNotLitigation,SearchTransfer,SearchLinkage,SearchCharge from t_Business_EmpSetting ");
            strSql.Append(" where RecordId=@RecordId ");
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "RecordId", DbType.Guid, RecordId);
            Chenxin.Lib.Business.Entity.t_Business_EmpSetting model = null;
            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = ReaderBind(dataReader);
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return model;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public static DataSet GetList(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,CityId,City,CompanyId,Company,DepartId,DepartName,UserId,UserCode,UserName,IsBelong,IsControl,SearchContractArchive,EditContractArchive,CancelContractArchive,SearchContractApply,EditContractApply,Addtime,SearchIntention,SearchBargain,SearchMoney,SearchBill,SearchPaidItems,SearchCommisionDetail,SearchIncomeSummary,SearchIncomeDetails,SearchIncomePersonal,SearchAchievementStat,SearchBargainStat,SearchAchievementDetail,SearchPersonalRank,SearchInCome,SearchTurnover,SearchIncomeOwner,SearchPreliminary,SearchLoan,SearchLitigation,SearchNotLitigation,SearchTransfer,SearchLinkage,SearchCharge ");
            strSql.Append(" FROM t_Business_EmpSetting ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
        }

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, string OrderField, string TableName, string strWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, strWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

        /// <summary>
        /// 获得数据列表（比DataSet效率高，推荐使用）
        /// </summary>
        public static List<Chenxin.Lib.Business.Entity.t_Business_EmpSetting> GetListArray(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select RecordId,CityId,City,CompanyId,Company,DepartId,DepartName,UserId,UserCode,UserName,IsBelong,IsControl,SearchContractArchive,EditContractArchive,CancelContractArchive,SearchContractApply,EditContractApply,Addtime,SearchIntention,SearchBargain,SearchMoney,SearchBill,SearchPaidItems,SearchCommisionDetail,SearchIncomeSummary,SearchIncomeDetails,SearchIncomePersonal,SearchAchievementStat,SearchBargainStat,SearchAchievementDetail,SearchPersonalRank,SearchInCome,SearchTurnover,SearchIncomeOwner,SearchPreliminary,SearchLoan,SearchLitigation,SearchNotLitigation,SearchTransfer,SearchLinkage,SearchCharge ");
            strSql.Append(" FROM t_Business_EmpSetting ");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }
            List<Chenxin.Lib.Business.Entity.t_Business_EmpSetting> list = new List<Chenxin.Lib.Business.Entity.t_Business_EmpSetting>();
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business_Search");
            using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
            {
                while (dataReader.Read())
                {
                    list.Add(ReaderBind(dataReader));
                }
                dataReader.Close();
                dataReader.Dispose();
            }
            return list;
        }


        /// <summary>
        /// 执行SQL（返回影响行数）
        /// </summary>
        public static bool ExecuteSQL(string strSQL)
        {
            Database db = DatabaseFactory.CreateDatabase("Chenxin_Business");
            int count = db.ExecuteNonQuery(CommandType.Text, strSQL);
            if (count > 0)
                return true;
            else
                return false;
        }

        /// <summary>
        /// 对象实体绑定数据
        /// </summary>
        public static Chenxin.Lib.Business.Entity.t_Business_EmpSetting ReaderBind(IDataReader dataReader)
        {
            Chenxin.Lib.Business.Entity.t_Business_EmpSetting model = new Chenxin.Lib.Business.Entity.t_Business_EmpSetting();
            object ojb;
            ojb = dataReader["RecordId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.RecordId = new Guid(ojb.ToString());
            }
            ojb = dataReader["CityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CityId = new Guid(ojb.ToString());
            }
            model.City = dataReader["City"].ToString();
            ojb = dataReader["CompanyId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CompanyId = new Guid(ojb.ToString());
            }
            model.Company = dataReader["Company"].ToString();
            ojb = dataReader["DepartId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.DepartId = new Guid(ojb.ToString());
            }
            model.DepartName = dataReader["DepartName"].ToString();
            ojb = dataReader["UserId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.UserId = new Guid(ojb.ToString());
            }
            model.UserCode = dataReader["UserCode"].ToString();
            model.UserName = dataReader["UserName"].ToString();
            ojb = dataReader["IsBelong"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsBelong = (bool)ojb;
            }
            ojb = dataReader["IsControl"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsControl = (bool)ojb;
            }
            ojb = dataReader["SearchContractArchive"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchContractArchive = (bool)ojb;
            }
            ojb = dataReader["EditContractArchive"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EditContractArchive = (bool)ojb;
            }
            ojb = dataReader["CancelContractArchive"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CancelContractArchive = (bool)ojb;
            }
            ojb = dataReader["SearchContractApply"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchContractApply = (bool)ojb;
            }
            ojb = dataReader["EditContractApply"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.EditContractApply = (bool)ojb;
            }
            ojb = dataReader["Addtime"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Addtime = (DateTime)ojb;
            }
            ojb = dataReader["SearchIntention"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchIntention = (bool)ojb;
            }
            ojb = dataReader["SearchBargain"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchBargain = (bool)ojb;
            }
            ojb = dataReader["SearchMoney"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchMoney = (bool)ojb;
            }
            ojb = dataReader["SearchBill"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchBill = (bool)ojb;
            }
            ojb = dataReader["SearchPaidItems"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchPaidItems = (bool)ojb;
            }
            ojb = dataReader["SearchCommisionDetail"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchCommisionDetail = (bool)ojb;
            }
            ojb = dataReader["SearchIncomeSummary"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchIncomeSummary = (bool)ojb;
            }
            ojb = dataReader["SearchIncomeDetails"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchIncomeDetails = (bool)ojb;
            }
            ojb = dataReader["SearchIncomePersonal"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchIncomePersonal = (bool)ojb;
            }
            ojb = dataReader["SearchAchievementStat"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchAchievementStat = (bool)ojb;
            }
            ojb = dataReader["SearchBargainStat"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchBargainStat = (bool)ojb;
            }
            ojb = dataReader["SearchAchievementDetail"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchAchievementDetail = (bool)ojb;
            }
            ojb = dataReader["SearchPersonalRank"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchPersonalRank = (bool)ojb;
            }
            ojb = dataReader["SearchInCome"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchInCome = (bool)ojb;
            }
            ojb = dataReader["SearchTurnover"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchTurnover = (bool)ojb;
            }
            ojb = dataReader["SearchIncomeOwner"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchIncomeOwner = (bool)ojb;
            }
            ojb = dataReader["SearchPreliminary"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchPreliminary = (bool)ojb;
            }
            ojb = dataReader["SearchLoan"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchLoan = (bool)ojb;
            }
            ojb = dataReader["SearchLitigation"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchLitigation = (bool)ojb;
            }
            ojb = dataReader["SearchNotLitigation"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchNotLitigation = (bool)ojb;
            }
            ojb = dataReader["SearchTransfer"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchTransfer = (bool)ojb;
            }
            ojb = dataReader["SearchLinkage"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchLinkage = (bool)ojb;
            }
            ojb = dataReader["SearchCharge"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.SearchCharge = (bool)ojb;
            }             
            return model;
        }

        #endregion  成员方法
    }
}
